<template>
  <div>
    <div
      data-h-cxk-news
      class="news"
    >
      <div
        data-h-cxk-news
        class="head-news"
      >
        <button
          data-h-cxk-news
          class="more"
        >全部></button>
        <h4
          data-h-cxk-news
          class="news-title"
        >最新资讯</h4>
      </div>
      <div
        data-h-cxk-news
        class="newsList"
      >
        <div
          data-h-cxk-news
          class="news-pick"
          v-for="(item, index) in news"
          :key="index"
        >
          <a
            data-h-cxk-news
            href=""
            @click="goinfo(item.hotid)"
          >
            <img
              data-h-cxk-news
              :src="item.img_url"
              alt=""
            >
          </a>
          <div
            data-h-cxk-news
            class="news-content-body"
          >
            <a
              data-h-cxk-news
              href=""
              @click="goinfo(item.hotid)"
            >{{item.title}}</a>
          </div>
          <div
            data-h-cxk-news
            class="time"
          >
            <div
              data-h-cxk-news
              class="watched"
            >{{item.watch}}</div>
            <div
              data-h-cxk-news
              class=""
            >猫眼电影</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {},
  components: {},
  data() {
    return {
      news: [],
    };
  },
  created() {
    this.getnews();
  },
  methods: {
    async getnews() {
      let {
        data: { message },
      } = await this.Api.hotspot.getnews();
      this.news = message.reverse().splice(0, 6);
    },
    goinfo(id) {
      this.$router.push(`/hotspot/news/${id}`);
    },
  },
};
</script>

<style lang="less">
.news[data-h-cxk-news] {
  margin: 0;
  padding: 0;
  width: 730px;
  height: 484px;
  float: left;
  background-color: rgb(255, 255, 255);
  .head-news[data-h-cxk-news] {
    line-height: 26px;
    margin-bottom: 20px;
    color: #ef4238;
    h4[data-h-cxk-news] {
      margin-top: 0px;
    }
    .news-title[data-h-cxk-news] {
      font-size: 26px;
      font-weight: 400;
      font-family: "Microsoft";
    }
    .more[data-h-cxk-news] {
      line-height: 26px;
      margin-top: 10px;
      outline: none;
      color: #ef4238;
      background-color: #fff;
      border: none;
      float: right;
    }
  }
  .newsList[data-h-cxk-news] {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    .news-pick[data-h-cxk-news] {
      width: 230px;
      height: 195px;
      img[data-h-cxk-news] {
        width: 230px;
        height: 129px;
      }
      .news-content-body[data-h-cxk-news] {
        width: 230px;
        height: 38px;
        white-space: normal;
        color: #333;
        font-size: 14px;
        a[data-h-cxk-news] {
          text-decoration: none;
          font-size: 14px;
          color: inherit;
        }
      }
      .time[data-h-cxk-news] {
        font-size: 12px;
        color: #999;
        .watched[data-h-cxk-news] {
          float: right;
        }
      }
    }
  }
}
</style>